import {searchSellReturnOrder} from '../../api/sellReturnOrderRecord'
import pickerOptions from  '@/utils/date';




let sellReturnOrderRecord = {
    data() {
        return {
            //日期组件
            pickerOptions:pickerOptions,
            //table的list
            tableData: [],
            total:0,
            sellOrderList:[],
            refuseReasonOptions:[
                {
                    value: '',
                    label: '全部'
                },
                {
                    value: '未在家',
                    label: '未在家'
                }, {
                    value: '不要了',
                    label: '不要了'
                }
            ],
            searchParams:{
                sellCode:"",
                consigneeName:'',
                deliveryAddress:'',
                refuseReason:'',
                deliveryCode:'',
                currentPage :1,
                pageSize:5
            }
        };
    },
    methods:{
        //复选框的change事件，删除和修改拿到id
        checkBoxSelectionChange(){

        },
        currentPageChange(currentPage){
            this.searchParams.currentPage = currentPage;
            this.findPage();
        },
        //每页条数变化
        sizeChange(pageSize) {
            this.searchParams.pageSize = pageSize;
            this.findPage();
        },
        async findPage(){
            let response =  await searchSellReturnOrder(this.searchParams);
            this.total= response.total;
            this.tableData = response.records;
        },
        chooseTime(){
            this.searchParams.startTime=this.pickerOptions.startArrayDate[0];
            this.searchParams.endTime=this.pickerOptions.startArrayDate[1];
        },
        resetForm(){
            this.searchParams={
                sellCode:'',
                consigneeName:'',
                deliveryAddress:'',
                deliveryCode:'',
                currentPage :1,
                pageSize:5
            };
            this.pickerOptions.startArrayDate ='';

        },
        checkDetail(row){
            let rowDetail = {};
            rowDetail = row;
            this.$router.push({path:"/sellReturnOrderRecordDetail/" , query:rowDetail});
        }
    },
    created(){
        this.findPage();
    }
};

export default sellReturnOrderRecord;